import { ILoadMapTypeAll } from '@/common';
import { handleAllDepartment, handleNotPostion } from '@/pages/ContractController/ContractManage/mconfig';
import { ManageCommonAPI } from '@/pages/type';
import { getFlowOrgTreeByOrgIDService } from '@/services/BaseLayout';
import { getLevelZeroJson, getSelectDataCommon, getTenantID } from '@/utils';
import { useEffect, useState } from 'react';

const getSearchList = (loadMdicMapList: Record<string, any>, queryTypeObj: Record<string, any>): ManageCommonAPI.ISearchList => {
  // 流程类别状态
  const orderTypeList = getSelectDataCommon(loadMdicMapList?.[`${getTenantID()}${ILoadMapTypeAll.ALLFLOW_TYPE}`], 'name', 'id');

  // let orgDeptList: any[] = [];
  // if (queryTypeObj?.params == 'createCompanyID') {
  //   orgDeptList = getLevelZeroJson();
  // } else if (queryTypeObj?.params == 'createDepartmentID') {
  //   orgDeptList = getLevelFirstJson();
  // }
  const orgDeptList: any = handleAllDepartment(getLevelZeroJson());

  return [
    {
      name: 'storeName',
      placeholder: '仓库名称',
      label: '仓库名称',
      componentType: 'Input',
      dataSource: orderTypeList,
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      treeID: 'id',
      treeName: 'name',
    },
    // {
    //   name: 'createFormName',
    //   placeholder: '申请',
    //   label: '申请',
    //   componentType: 'DeptAndUser',
    //   dataSource: getLevelZeroJson() ?? [],
    //   allowClear: true,
    //   md: 6,
    //   sm: 24,
    //   whetherSenior: false,
    //   formOrgType: {
    //     COMP: 'createCompanyID',
    //     DEPT: 'createDepartmentID',
    //     POS: 'createPositionID',
    //     USER: 'createrID',
    //   },
    // },
    // {
    //   name: 'storeNum',
    //   placeholder: '仓库编号',
    //   label: '仓库编号',
    //   componentType: 'Input',
    //   allowClear: true,
    //   md: 6,
    //   sm: 24,
    //   whetherSenior: false,
    //   searchParams: {
    //     fieldType: 'String',
    //     fieldParam: 0,
    //     fieldUse: 0,
    //     searchType: 0,
    //     seq: 0,
    //   },
    // },
    {
      name: 'storeCompanyID',
      placeholder: '仓库所属单位',
      label: '仓库所属单位',
      componentType: 'TreeSelect',
      dataSource: orgDeptList,
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      treeID: 'id',
      treeName: 'text',
      treeChildren: 'children',
    },
    // {
    //   name: 'storeState',
    //   placeholder: '仓库状态',
    //   label: '仓库状态',
    //   componentType: 'Input',
    //   allowClear: true,
    //   md: 6,
    //   sm: 24,
    //   whetherSenior: false,
    //   searchParams: {
    //     fieldType: 'String',
    //     fieldParam: 0,
    //     fieldUse: 0,
    //     searchType: 0,
    //     seq: 0,
    //   },
    // },
  ];
};

export { getSearchList };
